package com.zjol.traitdemo

/**
  * Created by Administrator on 2017/3/27.
  */

class  Human{
  println("human")
}


trait  TTeacher extends Human{
  println("Tteacher")
  def  teach
}

trait  PianoPlayer extends  Human{
  println("PianoPlayer")
  def  playPiano={println(" I'm traing status ")}
}

class  PianoTeacher extends  Human with TTeacher with  PianoPlayer{
  override def teach: Unit = {println("I'm training students.")}
}

trait  Action{
  def  doAction
}
trait  TBeforeAffter extends  Action{
  abstract  override def doAction = {
    println("Initializtion")
    super.doAction
    println("Destoryed")
  }
}

class  Work extends  Action{
  override def doAction = println("Working")
}



object traitDemo {

  def main(args: Array[String]): Unit = {

    val t1=new PianoTeacher
    t1.playPiano
    t1.teach


    val  work =new Work with TBeforeAffter;
    work.doAction
  }

}
